﻿using Microsoft.AspNetCore.Mvc;
using mozhi.smarterp.BasicData.Organizations;
using System.Threading.Tasks;
using Volo.Abp;

namespace mozhi.smarterp.BasicData.Controllers
{
    [RemoteService]
    [Route("api/v1/organizations")]
    public class OrganizationController : BasicDataController
    {
        private IOrganizationAppService _appService;

        public OrganizationController(IOrganizationAppService appService)
        {
            _appService = appService;
        }

        [HttpGet]
        public async Task<OrganizationDto> GetAsync()
        {
            return await _appService.GetAsync();
        }

        [HttpPost]
        public async Task<OrganizationDto> CreateAsync(OrganzationCreateDto input)
        {
            return await _appService.CreateAsync(input);
        }

        [HttpPut]
        public async Task<OrganizationDto> UpdateAsync(OrganzationUpdateDto input)
        {
            return await _appService.UpdateAsync(input);
        }
    }
}
